<?php
namespace Home\Model;
use Think\Model\RelationModel;
class GoodsModel extends RelationModel{
	
	protected $_link = array( 
	       
			'_brand'=>array(            
			'mapping_type'      => self::BELONGS_TO,            
			'class_name'        => 'Brand', 
			'foreign_key'       => 'bid', 
			'mapping_fields'    => 'name as bname', 
			'as_fields'         => 'bname'
			 ),
			 
			 
			 '_data'=>array(            
			'mapping_type'      => self::HAS_ONE,            
			'class_name'        => 'GoodsData', 
			'foreign_key'       => 'goodsid', 
			'mapping_fields'    => 'content', 
			'as_fields'         => 'content'
			 ),  
			 
			 
			 '_Activity'=>array(            
			'mapping_type'      => self::HAS_ONE,            
			'class_name'        => 'GoodsNActivity', 
			'foreign_key'       => 'goodsid', 
			'mapping_fields'    => 'type as atype,value as avalue', 
			'as_fields'         => 'atype,avalue'
			 ),                
			 
			   
	);

}